﻿<div id="body">
<?php
$id = (int)$_GET['id'];


/* защита по ид */

if(!isset($id) || !is_numeric($id) || $id<1){
	echo "<h2>Немога да намера страницата..</h2>";
}else {

	$username=$_SESSION['username'];
	
	
	$select_user=mysql_query('SELECT * FROM users WHERE id="'.$id.'"');
	$row_user=mysql_fetch_assoc($select_user);
	
	
	$sel_pic = mysql_query("SELECT * FROM avatars WHERE from_who = '".$row_user['username']."'");
	$row_avatar = mysql_fetch_assoc($sel_pic);
	
	if(mysql_num_rows($sel_pic)==1){
			  $img="<img src='../user_pics/".$row_avatar['pic_name']."' width='200' height='200' style='margin-left: 10px; box-shadow: 5px 5px 5px #000' alt='avatar'/>";
    }
	else{
	      $img="<img src='../user_pics/default.png' width='200' height='200' style='margin-left: 10px; box-shadow: 5px 5px 5px #000' alt='avatar'/>";
	}
	echo '<p style="float: left;">'.$img.'</p>';
	echo '<p style="position: relative; right: -20px;">Потребителско име: <b>'.$row_user['username'].'</b></p>';
	echo '<p style="position: relative; right: -20px;">E-Mail: <b>'.$row_user['email'].'</b></p>';
	echo "<br /><hr width='450px' align='right' />";
	echo '<p style="position: relative; right: -20px; bottom: -20px;">Име: <b>';
	
	echo $row_user['first_name'];
	echo '</b></p>';
	echo '<p style="position: relative; right: -20px; bottom: -20px;">Фамилия: <b>';
	echo $row_user['family'];
	echo '</b></p>';
	
		if($row_user['type']==1) $row_user['type']="Потребител";
		elseif($row_user['type']==2) $row_user['type']="Модератор";
		elseif($row_user['type']==3) $row_user['type']="Администратор";
	
	echo '<p style="position: relative; right: -20px; bottom: -20px;">Ранг: <b>'.$row_user['type'].'</b></p>';
	
	
	
	}
	
	?>
</div>